package com.example.demo.config.scheduler;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Mojo on 2017/9/7.
 * 定时任务：(方式一)使用Scheduled做定时任务()
 */
//@Component
public class TaskScheduing {

	SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

//	@Scheduled(fixedRate = 3000)
	@Scheduled(cron = "0 0 20 ? * THU") // cron表达式指定定时执行的周期
	public void timerRate() {
		System.out.println(simpleDateFormat.format(new Date()));
	}

}
